prefix=@prefix@
CFLAGS = @CFLAGS@
CFLAGS += -I.
PROG_LIB = libimmclient.a
SLIB_OBJS = TLC_TcpipImmClient.o TLC_ImmServer.o TLC_Utils.o \
            TLC_MemFile.o TLC_SocketClient.o  
DLIB_OBJS = TLC_LibImmClient.o TLC_Utils.o
SERVER_LIB=../server/libimm_server.so

CFLAGS = -g  -Wall -I. -I../include -I../server -I../client
# CFLAGS = -g -D__IMM_DEBUG__ -Wall -I. -I../include

all: $(PROG_LIB)

libimmclient.a: $(DLIB_OBJS)
	ar rc $(PROG_LIB) $(DLIB_OBJS)
TLC_LibImmClient.o: TLC_LibImmClient.cpp
	gcc $(CFLAGS) -c TLC_LibImmClient.cpp -o TLC_LibImmClient.o

slib: $(SLIB_OBJS)
	ar rc $(PROG_LIB) $(SLIB_OBJS)
TLC_LIB_OBJS TLC_TcpipImmClient.o: TLC_TcpipImmClient.cpp 
	gcc $(CFLAGS) -c TLC_TcpipImmClient.cpp -o TLC_TcpipImmClient.o
TLC_ImmServer.o: TLC_ImmServer.cpp TLC_ImmServer.hpp
	gcc $(CFLAGS) -c TLC_ImmServer.cpp -o TLC_ImmServer.o
TLC_Utils.o: TLC_Utils.cpp
	gcc $(CFLAGS) -c TLC_Utils.cpp -o TLC_Utils.o
TLC_MemFile.o: TLC_MemFile.cpp TLC_MemFile.hpp
	gcc $(CFLAGS) -c TLC_MemFile.cpp -o TLC_MemFile.o
TLC_SocketClient.o: TLC_SocketClient.cpp TLC_SocketClient.hpp
	gcc $(CFLAGS) -c TLC_SocketClient.cpp -o TLC_SocketClient.o

test: all $(SERVER_LIB)
	g++ $(CFLAGS) -D__DLL_SUPPORT__ -ldl -lpth test.cpp $(PROG_LIB) $(SERVER_LIB) -o test

install: all
	mkdir -p $(prefix)/lib/unicon
	cp -f $(PROG_LIB) $(prefix)/lib/unicon
clean:
	rm -f *.o a.out core *~ *.bak $(PROG_LIB) $(PROG)

distclean: clean
	rm -f Makefile tags TAGS

